home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / PROGASIC / BASFILES.LZH / HFRHAND.BAS < prev    next >
BASIC Source File  |  1988-07-07  |  4KB  |  246 lines

  1. '$INCLUDE: '\include\qbtools2.inc'
  2. DECLARE SUB HtxEdit ()
  3. '  hFrameHandler SUB to handle Help Text Frames, displayed
  4.  
  5.  
  6. hB.FileName = "TEST"
  7. hB.FrameNum = 1
  8. hB.PosDisplay = 1
  9. hB.Border = 1
  10. hB.Bfg = 7
  11. hB.Bbg = 0
  12. hB.Tfg = 0
  13. hB.Tbg = 7
  14. hB.Ounf = 7
  15. hB.Ounb = 0
  16. hB.Oslf = 0
  17. hB.Oslb = 7
  18.  
  19.  
  20. hFrameHandler hB
  21.  
  22. DEFSNG A-Z
  23. SUB hFrameHandler (hB AS hBuffer) STATIC
  24.     
  25.     DIM Htxt$(9), Halt$(9), Hpoint$(9), Altern$(9), AltPoint%(9)
  26.     DIM Scr%(2000), Ok%(42)
  27.  
  28.     SaveScreen Scr%(1)
  29.  
  30.     Number% = FREEFILE
  31.  
  32.     fl$ = hB.FileName
  33.     Trim fl$
  34.     fl$ = fl$ + ".FRM"
  35.  
  36.     OPEN fl$ FOR RANDOM AS #Number% LEN = 648
  37.     
  38.     Pcount% = 0
  39.     FOR j% = 1 TO 9
  40.         FIELD #Number%, Pcount% AS Dummy$, 50 AS Htxt$(j%), 20 AS Halt$(j%), 2 AS Hpoint$(j%)
  41.         Pcount% = Pcount% + 72
  42.     NEXT j%
  43.  
  44.     Gframe% = hB.FrameNum
  45.  
  46.     IF Gframe% < 0 THEN           ' This is a reference to a HELP TEXT
  47.                                                                 ' debug item call! i.e, this is in
  48.                                                                 ' DEBUG mode, and text may be modified
  49.  
  50.         hDebug% = 1
  51.         Gframe% = ABS(Gframe%)
  52.     ELSE                          ' Normal.....
  53.         hDebug% = 0
  54.     END IF
  55.  
  56.  
  57.     FrameOn% = 0   '  No frame there yet!
  58.  
  59.  
  60.     IF hDebug% = 1 THEN
  61.      
  62.         hB.PosDisplay = 1
  63.     END IF
  64.  
  65.  
  66.     IF hB.PosDisplay = 1 THEN
  67.         Topx% = 3
  68.         Topy% = 1
  69.         Topsx% = 57
  70.         Topsy% = 1
  71.     ELSE
  72.         Topx% = 3
  73.         Topy% = 12
  74.         Topsx% = 57
  75.         Topsy% = 12
  76.     END IF
  77.  
  78.     DO
  79.  
  80.         IF Gframe% = 0 THEN
  81.             EXIT DO
  82.         END IF
  83.  
  84.         GET #Number%, Gframe%
  85.  
  86.         Altv% = 0
  87.  
  88.         FOR j% = 1 TO 9
  89.             Tmp$ = Halt$(j%)
  90.             Trim Tmp$
  91.             IF LEN(Tmp$) THEN
  92.                 Altv% = Altv% + 1
  93.                 Altern$(Altv%) = Tmp$
  94.                 AltPoint%(Altv%) = CVI(Hpoint$(j%))
  95.             END IF
  96.         NEXT j%
  97.  
  98.         '
  99.         '  If there are no alternate choices here, then just exit
  100.         '
  101.  
  102.         IF Altv% = 0 THEN
  103.             EXIT DO
  104.         END IF
  105.  
  106.         IF FrameOn% = 0 THEN
  107.             FrameOn% = 1
  108.             DrawBox Topy%, Topx%, 52, 11, hB.Border, hB.Bfg, hB.Bbg, 1, hB.Tfg, hB.Tbg
  109.             Cattr% = Attributes%(hB.Tfg, hB.Tbg, 0, 0)
  110.             Ok%(41) = 1
  111.         END IF
  112.  
  113.         FOR j% = 1 TO 9
  114.             ColorPrint Htxt$(j%), j% + Topy%, Topx% + 1, Cattr%
  115.         NEXT j%
  116.      
  117.         GOSUB DebugMode
  118.      
  119.         rv% = 1
  120.         ScrollBox Altern$(), 20, 9, Topsx%, Topsy%, hB.Bfg, hB.Ounf, hB.Ounb, hB.Oslb, hB.Oslf, 0, Altv%, Ok%(), rv%, rst$, GlbErr%
  121.  
  122.         IF rv% > 0 THEN
  123.             Gframe% = AltPoint%(rv%)
  124.         ELSE
  125.             EXIT DO
  126.         END IF
  127.  
  128.     LOOP
  129.  
  130.     CLOSE #Number%
  131.  
  132.     RestoreScreen Scr%(1)
  133.     EXIT SUB
  134.  
  135.  
  136. DebugMode:
  137.  
  138.  
  139.  
  140.     HtxEdit           '  Display the startup screen
  141.  
  142.     FrameNum% = Gframe%
  143.  
  144.         GET #Number%, FrameNum%
  145.  
  146.         FOR j% = 1 TO 9
  147.             Row% = j% + 6
  148.             
  149.             h$ = Htxt$(j%)
  150.             QuickPrint h$, Row%, 2
  151.  
  152.             h$ = Halt$(j%)
  153.             QuickPrint h$, Row%, 54
  154.  
  155.             LOCATE Row%, 75, 0
  156.             PRINT USING "####"; CVI(Hpoint$(j%))
  157.         NEXT j%
  158.  
  159.         cx% = 1              '  Current X Location
  160.         Cy% = 1              '  Current Y Location
  161.  
  162.         DO
  163.             Row% = Cy% + 6
  164.                     
  165.             Aup% = 1
  166.             Adn% = 1
  167.  
  168.             IF Cy% = 1 THEN
  169.                 Aup% = 0
  170.             END IF
  171.  
  172.             IF Cy% = 9 THEN
  173.                 Adn% = 0
  174.             END IF
  175.  
  176.             SELECT CASE cx%
  177.                 
  178.                 CASE 1
  179.                     Wid% = 50
  180.                     h$ = Htxt$(Cy%)
  181.                     Col% = 2
  182.  
  183.                 CASE 2
  184.                     Wid% = 20
  185.                     h$ = Halt$(Cy%)
  186.                     Col% = 54
  187.  
  188.                 CASE ELSE
  189.  
  190.             END SELECT
  191.             
  192.             SELECT CASE cx%
  193.                 CASE 1, 2
  194.                     TextInput Aup%, 0, Adn%, 0, 1, 1, 1, Wid%, h$, Col%, Row%, 7, 0, 0, Ek%
  195.                     SELECT CASE cx%
  196.                         CASE 1
  197.                             LSET Htxt$(Cy%) = h$
  198.                         CASE 2
  199.                             LSET Halt$(Cy%) = h$
  200.                         CASE ELSE
  201.                     END SELECT
  202.  
  203.                 CASE 3
  204.                     Nv# = CDBL(CVI(Hpoint$(Cy%)))
  205.                     St$ = ""
  206.                     NumericInput Aup%, 0, Adn%, 0, 1, 1, 1, 4, 0, 1000, 0, St$, Nv#, 75, Row%, 7, 0, Ek%
  207.                     LSET Hpoint$(Cy%) = MKI$(CINT(Nv#))
  208.                 CASE ELSE
  209.             
  210.             END SELECT
  211.  
  212.             SELECT CASE Ek%
  213.                 CASE 1
  214.                     Cy% = Cy% - 1
  215.                 CASE 3
  216.                     Cy% = Cy% + 1
  217.                         IF Cy% > 9 THEN
  218.                             Cy% = 1
  219.                         END IF
  220.  
  221.                 CASE 5, 6
  222.                     cx% = cx% + 1
  223.                     IF cx% > 3 THEN
  224.                         Cy% = Cy% + 1
  225.                         cx% = 1
  226.                         IF Cy% > 9 THEN
  227.                             Cy% = 1
  228.                         END IF
  229.                     END IF
  230.                 CASE 7
  231.                     PUT #Number%, FrameNum%
  232.                     EXIT DO
  233.                 CASE ELSE
  234.             END SELECT
  235.  
  236.         LOOP
  237.  
  238.     RETURN
  239.  
  240.  
  241.  
  242.  
  243.  
  244. END SUB
  245.  
  246.